﻿using UnityEngine;
using System.Collections;

public class Enemy2XiaoChu : MonoBehaviour {


	public  GameObject[] obj = new GameObject[3];
	//速度
	float m_speed =1;
	Transform m_Transform;
	int m_a =0;
	void Start () {
	
		m_Transform = this.transform;
	}

	void Update () {
	
		for(int i=0;i<3;i++)
		{
			if(obj[i]==null)
			{
				m_a++;
			}
		}

		if(m_a>=3)
		{
			Destroy(this.gameObject);
		}
		m_a = 0;

		this.UpdataMove();
	}

	void UpdataMove()
	{
		float m_Y = m_Transform.position.y;
		m_Transform.position = new Vector3(m_Transform.position.x,m_Y-=Time.deltaTime*m_speed,0);
	}
}
